import instance from '@/utils/request'

//获取员工基本信息
export function getEmployees(id){
    return instance({
        url:`/sys/user/${id}`
    })
}

//获取员工列表
export function getEmployeesList(params){
    return instance({
        url:'/sys/user',
        params
    })
}

//批量导入员工
export function importEptApi(data){
    return instance({
        url:'/sys/user/batch',
        method:'POST',
        data
    })
}

//保存员工基本信息
export function saveBaseInfoApi(data){
    return instance({
        url:`/sys/user/${data.id}`,
        method:'PUT',
        data
    })
}

//获取员工详细个人信息
export function getPersonalInfoApi(id){
    return instance({
        url:`/employees/${id}/personalInfo`
    })
}

//保存员工个人信息
export function savePersonalInfoApi(data){
    return instance({
        url:`/employees/${data.userId}/personalInfo`,
        method:'PUT',
        data
    })
}

//获取员工岗位信息
export function getJobApi(id){
    return instance({
        url:`/employees/${id}/jobs`
    })
}

export function saveJobApi(data){
    return instance({
        url:`/employees/${data.userId}/jobs`,
        method:'PUT',
        data
    })
}

// 给员工分配角色
export function assignRolesApi(data){
    return instance({
        url:'/sys/user/assignRoles',
        method:'PUT',
        data
    })
}
